﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Framework;
using SchemaMonitor;

public partial class iframe : System.Web.UI.Page
{

	//Querystring
	public long UserId { get { return CWeb.RequestLong("userId"); } }

	protected void Page_Load(object sender, EventArgs e)
	{
		if (long.MinValue == UserId)
			return;

		var u = new CUser(UserId);
		var last = u.LastCheckElapsed();
		Response.Clear();
		Response.ContentType = "text/plain";

		if (last.TotalMinutes < 5)
		{
			Response.Write("Ran recently! " + CUtilities.Timespan(last));
			Response.End();
			return;
		}

		Response.Write("Last Ran: " + CUtilities.Timespan(last));
		CEngine.Process(u);
		Response.End();
	}
}